/*
 * 1.00 2012/09/19
 *
 * Copyright (c) 2012 Motch_bs
 * All rights reserved.
 *
 * このソフトウェアは，Motch_bsに所有される機密情報である。
 * これらの機密情報を漏洩してはならず，Motch_bs の意図する
 * 認可の元においてこれを使用すべし。
 */
package jp.co.ufp.sevendaystask_free.listners;

import jp.co.ufp.sevendaystask_free.Main;

import org.achartengine.GraphicalView;
import org.achartengine.model.SeriesSelection;

import android.util.Log;
import android.view.View;
import android.view.View.OnLongClickListener;

/**
 * 初期画面のロングクリックリスナー
 * 
 * @author Motch_bs
 * 
 */
public class MainOnLongClickListener implements OnLongClickListener {

    /** リスナー登録元クラス */
    private Main main;

    /** グラフVIEW */
    private GraphicalView chartView;

    /** 選択オブジェクト */
    private SeriesSelection seriesSelection;

    /**
     * @param pMain
     * @param pChartView
     */
    public MainOnLongClickListener(Main pMain, GraphicalView pChartView) {
	super();
	this.main = pMain;
	this.chartView = pChartView;
    }

    @Override
    public boolean onLongClick(
	View arg0) {
	seriesSelection = chartView.getCurrentSeriesAndPoint();
	if (seriesSelection == null) {
	    Log.d("MainOnLongClickListener", "No chart element was long presse");
	    return false;
	    // no chart element was long pressed, so
	    // let something
	    // else handle the event
	}
	else {
	    String msg = "Chart element data point index "
		    + seriesSelection.getPointIndex()
		    + " was long pressed";
	    Log.d("MainOnLongClickListener", msg);
	    return true;
	    // the element was long pressed - the event

	    // has been
	    // handled
	}
    }

}
